
** Figure A6: Human Capital 


use "$OUTDATA/NFHS_sample.dta", clear 


* Macros

* Outcomes

global dec " w_dec n_w_dec sayl hcdec huss saysc "
global viol " injuries n_inj viol_p2 viol_p1 viol_s viol_e "

global marriage "age_marr age_gap educ_gap height_diff workh h_goodjob h_earnless drunk_often"
global wealth "asset1 asset2 modern_cook modern_roof agrland_hec wealth_index sl_index "
global hc "educw primary height lowheight"
global reporting "viol_byothers viol_natal told_anyone sought_help1 sought_help2 sought_help3"

* Covariates and FE
global cov "rural christian hindu scstbc"
global cov1 "wealth_index hhsize educw"
global cov2 "ageh educh workw workh"
global fe1   "i.state i.yy_1marr"
global fe2   "i.state i.yearb"
global did "i.dow_cohort##i.hindu1"

global cluster "state"

global graph "ylabel(, nogrid) scheme(s2mono) plotregion(fcolor(white) lcolor(white) margin(small)) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white))"


* Labels for Tables

label var w_dec "\shortstack{Any \\ Decision}"
label var n_w_dec "\shortstack{No. of \\ Decisions}"
label var sayl "\shortstack{Household \\ Purchases}"
label var hcdec "\shortstack{Health \& \\ Contracept.}"
label var huss "\shortstack{Husband's \\ Money}"
label var saysc "\shortstack{Daily \\ Decisions}"

label var injuries "\shortstack{Any \\ Injury}"
label var n_inj "\shortstack{No. of \\ Injuries}"
label var viol_p2 "\shortstack{Severe \\ Violence}"
label var viol_p1 "\shortstack{Less Severe \\ Violence}"
label var viol_s "\shortstack{Sexual \\ Violence}"
label var viol_e "\shortstack{Emotional \\ Violence}"

label var age_marr "\shortstack{Age at \\ Marriage}"
label var age_gap "\shortstack{Spousal \\ Age Gap}"
label var educ_gap "\shortstack{Spousal \\ Educ. Gap}" 
label var height_diff "\shortstack{Absolute \\ Height Gap}" 
label var workh "\shortstack{Husband \\ Employed}" 
label var h_goodjob "\shortstack{Husband \\ White Collar \\ Job}"   
label var h_earnless "\shortstack{Husband \\Earns Less \\ or Same}" 
label var drunk_often "\shortstack{Husband \\Often Drunk}"

label var educw "\shortstack{Years of \\ Schooling}"
label var primary "\shortstack{Primary \\ School}"
label var height "\shortstack{Height \\(cm)}"
label var lowheight "\shortstack{Low \\ Height}"

label var viol_byothers "\shortstack{Viol. \\ by Others}"
label var viol_natal "\shortstack{Viol. in \\ Natal Family}"
label var told_anyone "\shortstack{Has Told \\ Anyone }"
label var sought_help1 "\shortstack{Help \\ From Family}"
label var sought_help2 "\shortstack{Help From \\ Friends \& \\ Network}"
label var sought_help3 "\shortstack{Help From \\ Police\/Doctor}"

label var scstbc "SC/ST/OBC"
label var rural "Rural"
label var muslim "Muslim"
label var christian "Christian"
label var hindu "Hindu"
label var wealth_index "Wealth Index"
label var hhsize "Household Size"
label var workw "Employed in Past 12 Months"
label var nkids "No. Kids"
label var nkids_home "No. Kids at Home"
label var nomorec "Completed Fertility"
label var kids_home "Kids at Home"


cap drop age1985*

gen age1985 = 1985-yearb	
gen age1985_cat = 4*(age1985<=5) + 3*(age1985>5&age1985<=10) + 2*(age1985>10&age1985<=20) + 1*(age1985>20)

eststo clear

foreach y in educw primary {

	eststo: reg `y' $did $cov $fe2 [pweight = v005], r cl($cluster )
	qui sum `y' if e(sample)
	estadd scalar m =r(mean)
	
	forvalues i = 1(1)4 {
	eststo: reg `y' $did $cov $fe2 [pweight = v005] if age1985_cat == `i', r cl($cluster )
	qui sum `y' if e(sample)
	estadd scalar m =r(mean)
	
	}
	
	}
	
esttab using "$OUTDIR/NFHS3_educbyage.tex", ///
booktabs nonotes replace indicate("\hline\vspace{-3mm} \\ \vspace{-3mm}  Individual Controls = $cov " " \vspace{-3mm} State FE = *.state " " Year of Birth FE = *.yearb ", labels("Yes" "$-$") ) ///
keep(1.dow_cohort#1.hindu1) ///
label interaction(" \$\times\$ ") substitute("=1" "") ///
stats(N r2 m, labels("Obs." "R sq." "Mean Dep. Var.") fmt(%9.0fc %9.3fc))   ///
se star(* 0.10 ** 0.05 *** 0.01)  b(%9.3fc) se(%9.3fc) 


eststo clear

foreach y in height lowheight {

	eststo: reg `y' $did $cov $fe2 [pweight = v005], r cl($cluster )
	qui sum `y' if e(sample)
	estadd scalar m =r(mean)
	
	forvalues i = 1(1)4 {
	eststo: reg `y' $did $cov $fe2 [pweight = v005] if age1985_cat == `i', r cl($cluster )
	qui sum `y' if e(sample)
	estadd scalar m =r(mean)
	
	}
	
	}
	
	
esttab using "$OUTDIR/NFHS3_heightbyage.tex", ///
booktabs nonotes replace indicate("\hline\vspace{-3mm} \\ \vspace{-3mm}  Individual Controls = $cov " " \vspace{-3mm} State FE = *.state " " Year of Birth FE = *.yearb ", labels("Yes" "$-$") ) ///
keep(1.dow_cohort#1.hindu1) ///
label interaction(" \$\times\$ ") substitute("=1" "") ///
stats(N r2 m, labels("Obs." "R sq." "Mean Dep. Var.") fmt(%9.0fc %9.3fc))   ///
se star(* 0.10 ** 0.05 *** 0.01)  b(%9.3fc) se(%9.3fc) 



** No effect on women born before 1970 (at least for height and primary school completion (add a footnote or briefly mention in text)

foreach y in $hc {

	eststo: reg `y' $did $cov $fe2 [pweight = v005] if yearb<1970, r cl($cluster )
	qui sum `y' if e(sample)
	estadd scalar m =r(mean)
	
	}

***

cap drop age1985*

gen age1985 = 1985-yearb	
gen age1985_cat = 4*(age1985<=5) + 3*(age1985>5&age1985<=10) + 2*(age1985>10&age1985<=20) + 1*(age1985>20)

mat def hc_byage = J(4,5,0)
mat def hc_byage_ub = J(4,5,0)
mat def hc_byage_lb = J(4,5,0)

forvalues i = 1(1)4 {
	
	mat hc_byage[`i',1] = `i'
	reg educw dowTreat dow_cohort hindu1  $cov $fe2 [pweight = v005] if age1985_cat == `i', r cl($cluster )
	mat hc_byage[`i',2] = _b[dowTreat]
	mat hc_byage_ub[`i',2] = _b[dowTreat]+1.96*_se[dowTreat]
	mat hc_byage_lb[`i',2] = _b[dowTreat]-1.96*_se[dowTreat]
	
	reg primary dowTreat dow_cohort hindu1  $cov $fe2 [pweight = v005] if age1985_cat == `i', r cl($cluster )
	mat hc_byage[`i',3] = _b[dowTreat]
	mat hc_byage_ub[`i',3] = _b[dowTreat]+1.96*_se[dowTreat]
	mat hc_byage_lb[`i',3] = _b[dowTreat]-1.96*_se[dowTreat]
	
	reg height dowTreat dow_cohort hindu1  $cov $fe2 [pweight = v005] if age1985_cat == `i', r cl($cluster )
	mat hc_byage[`i',4] = _b[dowTreat]
	mat hc_byage_ub[`i',4] = _b[dowTreat]+1.96*_se[dowTreat]
	mat hc_byage_lb[`i',4] = _b[dowTreat]-1.96*_se[dowTreat]
	
	reg lowheight dowTreat dow_cohort hindu1  $cov $fe2 [pweight = v005] if age1985_cat == `i', r cl($cluster )
	mat hc_byage[`i',5] = _b[dowTreat]
	mat hc_byage_ub[`i',5] = _b[dowTreat]+1.96*_se[dowTreat]
	mat hc_byage_lb[`i',5] = _b[dowTreat]-1.96*_se[dowTreat]
	
	}
	
cap drop hc_byage*
cap svmat hc_byage
cap svmat hc_byage
cap svmat hc_byage

label var hc_byage2 "Effect on Years of Schooling"
label var hc_byage4 "Effect on Height"

label var hc_byage3 "Effect on Pr(Primary School)"
label var hc_byage5 "Effect on Pr(Low Height)"

tw (connect hc_byage2 hc_byage1, lc(black) mc(black)) (connect hc_byage3 hc_byage1, lc(black) mc(black) yaxis(2) m(diamond) lp(dash))  , ///
ylabel(, nogrid)plotregion(fcolor(white) lcolor(white) margin(small)) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white)) ///
xtitle("Age in 1985")  xlabel(1 "21 or Older" 2 "11 to 20" 3 "6 to 10" 4 "5 or Younger") legend(col(1))
graph export "$OUTDIR/educ_byage.png" , replace 

tw (connect hc_byage4 hc_byage1, lc(black) mc(black) m(square)) (connect hc_byage5 hc_byage1, lc(black) mc(black) yaxis(2) m(triangle) lp(dash))  , ///
ylabel(, nogrid)plotregion(fcolor(white) lcolor(white) margin(small)) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white)) ///
xtitle("Age in 1985") xlabel(1 "21 or Older" 2 "11 to 20" 3 "6 to 10" 4 "5 or Younger") legend(col(1))
graph export "$OUTDIR/height_byage.png" , replace 

